<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->unsigned()->index()->comment('用户id');
            $table->string('ip', 30)->default('')->comment('登录ip');
            $table->string('address', 60)->default('')->comment('登录地点');
            $table->string('os', 30)->default('')->comment('客户端操作系统');
            $table->tinyInteger('status')->unsigned()->default(1)->index()->comment('状态1成功2失败');
            $table->string('msg', 30)->default('')->comment('操作信息描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('logs');
    }
}
